package com.life.ai.server.framework.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class ResourceConfig implements WebMvcConfigurer {

    private static final String URL_PATH_PATTERN = "/images/**";

    private static final String FILE_SYSTEM_PATH = "D:/upload/";

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 注册资源处理器
        registry.addResourceHandler(URL_PATH_PATTERN)
                .addResourceLocations("file:" + FILE_SYSTEM_PATH);
    }
}